package helpers

import (
	"ginTea/structs"
)

// Success 返回 response
func Success(data interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: true,
		Code:    200,
		Message: "",
		Data:    data,
	}
}

// SuccessWithMessage 返回 response
func SuccessWithMessage(data interface{}, message string) structs.JSONResponse {

	return structs.JSONResponse{
		Success: true,
		Code:    200,
		Message: message,
		Data:    data,
	}
}

// SuccessWithPointChange 返回 response
func SuccessWithPointChange(data interface{}, pointChange interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: true,
		Code:    200,
		Message: "",
		Data:    data,
	}
}

// SuccessWithExtra 返回 response
func SuccessWithExtra(data interface{}, extra interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: true,
		Code:    200,
		Message: "",
		Data:    data,
	}
}

// E401 返回 response
func E401(message string) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    401,
		Message: message,
		Data:    nil,
	}
}

// E4004 返回 response
func E4004(message string) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    4004,
		Message: message,
		Data:    nil,
	}
}

// OverLimitNeedLogin 登录以查看更多
func OverLimitNeedLogin(data interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    4012,
		Message: "登录以查看更多",
		Data:    nil,
	}
}

// OperatorNeedLogin 此操作需要登录
func OperatorNeedLogin(data interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    4012,
		Message: "此操作需要登录",
		Data:    nil,
	}
}

// Error 返回 response
// 业务错误
func Error(message string) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    5002,
		Message: message,
		Data:    nil,
	}
}

// Error 返回 response
// 业务错误
func ErrorWithSensitive(message string) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    5012,
		Message: message,
		Data:    nil,
	}
}

//敏感
func ErrorWithSensitiveData(message string, data interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: false,
		Code:    5012,
		Message: message,
		Data:    data,
	}
}

// ErrorCustom 返回 response
func ErrorCustom(message string, code int, data interface{}) structs.JSONResponse {
	return structs.JSONResponse{
		Success: false,
		Code:    code,
		Message: message,
		Data:    data,
	}
}

// Error 返回 response
// 业务错误
func SuccessNeedAudit(message string, data interface{}) structs.JSONResponse {

	return structs.JSONResponse{
		Success: true,
		Code:    2001,
		Message: message,
		Data:    data,
	}
}
